package cn.myschool.myschool.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author oldliu
 * @since 1.0
 */
@Configuration
@MapperScan("cn.myschool.myschool.mapper")
public class MyBConfig {
    //    @Bean
//    public PaginationInnerInterceptor paging(){
//        PaginationInnerInterceptor interceptor=new PaginationInnerInterceptor();
//        interceptor.setDbType(DbType.MYSQL);
//
//        return interceptor;
//    }
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
